﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Portal.Xml.Utility;

namespace Portal.Systems.Model
{
    public class RoleExtraConfigCls
    {
        public string RoleExtraConfigId;
        public string RoleId = "";
        public string Categories = "";
        public string DataLanguageId = "";
        public string AssetCode = "";
    }


    public class RoleExtraConfigParser
    {
        public static RoleExtraConfigCls CreateInstance()
        {
            //tao 1 class trang....
            RoleExtraConfigCls oRoleExtraConfigCls = new RoleExtraConfigCls();
            return oRoleExtraConfigCls;
        }

        public static RoleExtraConfigCls ParseFromXml(string XmlData)
        {
            DataSet ds = XmlUtility.GetDataSetFromXml(XmlData);
            RoleExtraConfigCls oRoleExtraConfigCls = ParseFromDataRow(ds.Tables[0].Rows[0]);
            return oRoleExtraConfigCls;
        }


        public static RoleExtraConfigCls ParseFromDataRow(DataRow dr)
        {
            RoleExtraConfigCls ORoleExtraConfigCls = new RoleExtraConfigCls();
            ORoleExtraConfigCls.RoleExtraConfigId = XmlUtility.GetString(dr, "RoleExtraConfigId", true);
            ORoleExtraConfigCls.RoleId = XmlUtility.GetString(dr, "RoleId", true);
            ORoleExtraConfigCls.Categories = XmlUtility.GetString(dr, "Categories", true);
            ORoleExtraConfigCls.DataLanguageId = XmlUtility.GetString(dr, "DataLanguageId", true);
            ORoleExtraConfigCls.AssetCode = XmlUtility.GetString(dr, "AssetCode", true);

            return ORoleExtraConfigCls;
        }

        public static RoleExtraConfigCls[] ParseFromDataTable(DataTable dtTable)
        {
            RoleExtraConfigCls[] RoleExtraConfigs = new RoleExtraConfigCls[dtTable.Rows.Count];
            for (int iIndex = 0; iIndex < dtTable.Rows.Count; iIndex++)
            {
                RoleExtraConfigs[iIndex] = ParseFromDataRow(dtTable.Rows[iIndex]);
            }

            return RoleExtraConfigs;
        }

    }
}



